<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %>

<form method="post" action="/Orcamento/payment/update">
	<fieldset>
		<legend>Editar Pagamento</legend>
		<label>
			Evento:
			<select name="spent.event.id" required>
				<option value="">Selecione um evento</option>
				<c:forEach items="${events}" var="event">
					<c:choose>
						<c:when test="${spent.event.id != event.id}">
							<option value="${event.id}">${event.name}</option>
						</c:when>
						<c:otherwise>
							<option value="${event.id}" selected>${event.name}</option>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>
		</label>
		<label>
			Valor
			<input type="text" value="${spent.value}" name="spent.value" placeholder="Valor do Pagamento" autofocus required class="input-medium money">
		</label>
		<label>
			Data
			<input type="date" name="spent.spentDay" required class="input-medium" value="<joda:format value="${spent.spentDay}" pattern="YYYY-MM-dd" />" />
		</label>
		<input type="hidden" name="spent.id" value="${spent.id}" >
		<input type="hidden" name="spent.invoice.id" value="${spent.invoice.id}" >
		<button type="submit" class="btn" id="submit">Cadastrar</button>	
	</fieldset>
</form>